<?php

use yii\helpers\Url;
use yii\helpers\ArrayHelper;

$this->title = "首页";
?>
<div class="brand"></div>
<div class="content-padded">
    <p>
        <a href="<?php echo Url::toRoute(["task/work"]); ?>" data-no-cache="true" class="button button-big button-fill button-success">马上接任务</a>
    </p>
</div>
<div class="list-block" style="margin-top:0;">
    <ul>
        <li>
            <a href="<?php echo Url::toRoute(["task/mynowork"]); ?>" data-no-cache="true" class="item-link item-content">
                <div class="item-media"><span class="iconfont i-my"></span></div>
                <div class="item-inner">提交任务</div>
            </a>
        </li>
        <li>
            <a href="<?php echo Url::toRoute(["account/tixian"]); ?>" data-no-cache="true" class="item-link item-content">
                <div class="item-media"><span class="iconfont i-account"></span></div>
                <div class="item-inner">我要提现</div>
            </a>
        </li>
        <li>
            <a href="<?php echo Url::toRoute(["profile/invite"]); ?>" class="item-link item-content">
                <div class="item-media"><span class="iconfont i-share"></span></div>
                <div class="item-inner">邀请小伙伴</div>
            </a>
        </li>
        <li>
            <a href="<?php echo Url::toRoute(["task/tousu"]); ?>" class="item-link item-content">
                <div class="item-media"><span class="iconfont i-service"></span></div>
                <div class="item-inner">我要申诉</div>
            </a>
        </li>
        <li>
            <a href="<?php echo Url::toRoute(["article/contact"]); ?>" class="item-link item-content">
                <div class="item-media"><span class="iconfont i-telephone"></span></div>
                <div class="item-inner">联系我们</div>
            </a>
        </li>
        <li>
            <a href="<?php echo Url::toRoute(["article/help"]); ?>" class="item-link item-content">
                <div class="item-media"><span class="iconfont i-question"></span></div>
                <div class="item-inner">帮助中心</div>
            </a>
        </li>
        <li>
            <a href="javascript:;" class="item-link item-content" id="pop-1">
                <div class="item-media"><span class="iconfont i-question"></span></div>
                <div class="item-inner">公众号接单</div>
            </a>
        </li>
    </ul>
</div>
<?php $this->beginBlock('index-tip') ?>
//使用示例
var tipnum = (getCookie("tipnum") == 'NaN' || getCookie("tipnum") == "" || getCookie("tipnum") == null) ? 0 : parseInt(getCookie("tipnum"));
if(tipnum < 5){
    setCookie("tipnum",tipnum + 1,'d30');
    showtip();
}
function showtip(){
$.modal({
title:  '活动公告',
text: '<div class="gonggaotip">亲，公众号做任务已经开通了，为了方便，微信扫描：下方二维码进入公众号进行做任务！<br /><img src="/images/qrcode.jpg"  width="158" height="158"/></div>',
buttons: [
{
text: '朕，知道了',
bold: true
},
]
})
}
$(document).on('click','#pop-1', function () {
showtip();
});
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
function delCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null)
document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

//如果需要设定自定义过期时间
//那么把上面的setCookie　函数换成下面两个函数就ok;
//程序代码
function setCookie(name,value,time)
{
var strsec = getsec(time);
var exp = new Date();
exp.setTime(exp.getTime() + strsec*1);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getsec(str)
{
var str1=str.substring(1,str.length)*1;
var str2=str.substring(0,1);
if (str2=="s")
{
return str1*1000;
}
else if (str2=="h")
{
return str1*60*60*1000;
}
else if (str2=="d")
{
return str1*24*60*60*1000;
}
}
<?php $this->endBlock() ?>  
<?php $this->registerJs($this->blocks['index-tip'], \yii\web\View::POS_END); ?>
